05. Swagger Configuration
JAVA C2 L7 05 Swagger Configuration
The configuration of Swagger mainly centers around the Docket bean.
@Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); } }
Swagger also provides some default values in its response that you can customize, such as “Api Documentation”, “Created by Contact Email”, “Apache 2.0”.
To change these values, you can use the apiInfo(ApiInfo apiInfo)
method.